package main

import (
	"fmt"
	"math/rand"
	"net"
)

func main () {
	conn, err := net.Dial("tcp", "localhost:10010")

	if err != nil {
		fmt.Println("Erroring dialing", err.Error())
		return
	}

	//defer conn.Close()

	//rand.Seed(time.Now().Unix())
	//for i :=1 ;;i++{
		input := rand.Intn(100)
		trimedinput := input
		//time.Sleep(100*time.Millisecond)
		ss := fmt.Sprint(trimedinput)
		var bb = []byte(ss)
		_,err = conn.Write(bb)
		//if trimedinput == 1 {
		//	aa := fmt.Sprintf("随机输出为1，停止程序！输出次数为：%v",i)
		//	cc := []byte(aa)
		//	_,err := conn.Write(cc)
		//	if err != nil{
		//		return
		//	}
		//	fmt.Println("随机输出为1，停止程序！输出次数为：",i)
		//	return
		//}
		if err != nil {
			return
		}
	}

